/*****************************************************
Copyright (C) 2020. All rights reserved.
File name     ：TestMain.c
Version       ：v1.0
Author        ：zhengqijun
Date          ：2020-05-11
Function List ：
Description   ：main function
******************************************************/

#include <stdio.h>  // for printf
#include "SkipList.h"

// main function
int main(void) {
    SkipList L = NULL;
    int i;

    L = Initialize();
    L = MakeEmpty(L);

    if (IsEmpty(L)) {
        printf("SkipList is empty!\n");
    } else {
        printf("SkipList is not empty!\n");
    }

    printf("Insert SkipList:[ ");
    for (i = 0; i < 16; ++i) {
        printf("%d ", i + 1);
        L = Insert(i + 1, L);
    }
    printf("]\n");

    if (IsEmpty(L)) {
        printf("SkipList is empty!\n");
    } else {
        printf("SkipList is not empty!\n");
    }

    if (IsEmpty(Find(5, L))) {
        printf("Can not find element 5 in skip list!\n");
    } else {
        printf("Find element 5 in skip list!\n");
    }

    printf("Min is %d in skip list!\n", Retrieve(FindMin(L)));
    printf("Max is %d in skip list!\n", Retrieve(FindMax(L)));

    L = Delete(4, L);
    printf("Delete element 4 in skip list!\n");

    Destroy(L);

    return 0;
}

// EOF

